package com.zoe.onelink.ratelimit.sepc.impl;

import com.alibaba.csp.sentinel.SphO;
import com.zoe.onelink.ratelimit.sepc.ApiRateLimiter;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2022</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2022-12-07
 */
public class SentinelApiRateLimiter implements ApiRateLimiter {
    @Override
    public boolean accept(String resourceId) {
        boolean entry = SphO.entry(resourceId);
        if (entry) {
            SphO.exit();
        }
        return entry;
    }

}
